home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-13 / emacs16d.zip / _INPUT.MIN < prev    next >
Text File  |  1991-08-09  |  10KB  |  559 lines

  1.  
  2.  
  3.  
  4. Name:F:abort-recursive-edit
  5. [*]endrecurse-abort[*]
  6.  
  7.  
  8. Name:F:exit-recursive-edit
  9. [*]endrecurse[*]
  10.  
  11.  
  12. Name:F:recursive-edit
  13. Call with arg1 = code to execute if the user wishes to continue the function.
  14. [*]#(ds,k,##(gs,Funwind-recurse,#(Farglist)))
  15. #(mp,k,#(Farglist))
  16. #(ds,Fmode-parens,[##(Fmode-parens,ARG1)])
  17. #(mp,Fmode-parens,SELF,ARG1)
  18. #(Fdo-recursive-edit)
  19. #(==,##(result),endrecurse,(
  20.     arg1
  21. ),(
  22.     #(F:ring-the-bell)
  23. ))
  24. #(k,foo)
  25. [*]
  26.  
  27.  
  28. Name:Fcompleting-readline
  29. [*]#(ds,completing-set,(arg3))
  30. #(ds,completing-separator,(arg4))
  31. #(Freadline,(arg1),(arg2),Fcompleting-readline)[*]
  32.  
  33.  
  34. Name:Fcompleting-readline. 
  35. [*]#(ds,value,##(value)##(2nd-half))
  36. #(ds,2nd-half)
  37. #(Ffind-a-match,#(completing-set),(
  38.     #(bl)
  39.     again
  40. ),(
  41.     #(ds,value,
  42.         ##(gn,temp,##(nc,##(gs,value)))
  43.         #(ds,temp,##(temp))
  44.         #(==,##(fm,temp,#(completing-separator),!!!)##(rs,temp),!!!,(
  45.             ##(temp)
  46.         ),(
  47.             ##(fm,temp,#(completing-separator))
  48.             #(completing-separator)
  49.         ))
  50.     )
  51.     again
  52. ),(
  53.     #(ds,value,
  54.         ##(gn,temp,##(nc,##(gs,value)))
  55.         #(ds,temp,##(temp))
  56.         #(==,##(temp),,,(
  57.             #(==,##(fm,temp,#(completing-separator),!!!)##(rs,temp),!!!,(
  58.                 ##(temp)
  59.             ),(
  60.                 ##(fm,temp,#(completing-separator))
  61.                 #(completing-separator)
  62.             ))
  63.         ))
  64.     )
  65.     #(==,##(temp),,(
  66.         #(Freadline-an,(arg3))
  67.         #(..,#(Fcompleting-readline.?))
  68.     ))
  69.     again
  70. ))
  71. [*]
  72.  
  73.  
  74. Name:Fcompleting-readline.?
  75. [*]#(ds,temp,#(completing-set))
  76. #(ow,(
  77. Possible completions are:
  78. ))
  79. #(ds,temp,##(sa,#(temp)))
  80. #(mp,temp,,(,))
  81. #(Fmore)
  82. again[*]
  83.  
  84.  
  85. Name:Fcompleting-readline.C-i
  86. [*]#(ds,value,##(value)##(2nd-half))
  87. #(ds,2nd-half)
  88. #(Ffind-a-match,#(completing-set),(
  89.     #(ds,readline-msg, [No match])
  90.     #(bl)
  91.     again
  92. ),(
  93.     #(n?,longest-matched,(
  94.         #(==,##(value),##(temp),(
  95.             #(ds,readline-msg,( [Complete, but not unique]))
  96.         ))
  97.     ),(
  98.         #(==,##(value),##(temp),(
  99.             #(ds,readline-msg, [Sole completion])
  100.         ))
  101.     ))
  102.     #(ds,value,##(temp))
  103.     again
  104. ),(
  105.     #(ds,value,
  106.         ##(gn,temp,##(nc,##(gs,value)))
  107.         #(ds,temp,##(temp))
  108.         ##(temp)
  109.     )
  110.     #(Freadline-an,(arg3))
  111.     #(==,##(temp),,(
  112.         #(..,#(Fcompleting-readline.?))
  113.     ))
  114.     again
  115. ))[*]
  116.  
  117.  
  118. Name:Fcompleting-readline.Tab
  119. [*]#(Fcompleting-readline.C-i,(arg1))[*]
  120.  
  121.  
  122. Name:Fdo-recursive-edit
  123. [*]#(Fredisplay)#(d,#(g))#(==,##(gn,result,4)#(rs,result),endr,,(#(SELF)))[*]
  124.  
  125.  
  126. Name:Ferror
  127. Report arg1 as an error only if it is non-null.
  128. [*]#(==,arg1,,(
  129.     #(an)
  130. ),(
  131.     #(an,arg1!)
  132.     #(Fflush-input-buffer)
  133. ))
  134. [*]
  135.  
  136.  
  137. Name:Fget-key
  138. This is the prototype for #(g), the function to get keys from the user.
  139. [*]##(it,10000)[*]
  140.  
  141.  
  142. Name:Fget-key-with-prefixes
  143. This function will get a key even if they key is prefixed with something.
  144. [*]#(SELF-do,#(g))[*]
  145.  
  146.  
  147. Name:Fget-key-with-prefixes-do
  148. Extended to handle multiple prefixes, as in C-x 4 f
  149. [*]#(ds,temp,#(K.arg1))
  150. #(==,##(nc,##(fm,temp,:prefix-)),1,(
  151.     #(an,##(temp))
  152.     #(SELF,#(temp)#(g))
  153. ),arg1)
  154. [*]
  155.  
  156.  
  157. Name:Fhit-any-key
  158. Give the user a chance to see his overwritten output.  If they press anything
  159. other than space, use it as input.
  160. [*]#(ow,-----[Hit any key; only space is discarded]-----())
  161. #(ds,temp,#(n?,kbd-macro-g,(#(kbd-macro-g)),(#(g))))
  162. #(==,##(temp), ,,(
  163.     #(Fkbd-in,##(temp),x)
  164. ))
  165. #(rd)
  166. [*]
  167.  
  168.  
  169. Name:Finsist
  170. Insist upon a non-null arg1.
  171.   arg1 = argument to supply
  172.   arg2 = function to call with the argument.
  173.   arg3 = code to execute if they supply the argument.
  174. [*]#(==,(arg1),,(
  175.     #(ds,temp,arg2)
  176.     #(..,##(gn,temp,2))
  177.     #(ds,value,##(default.##(temp)))
  178.     #(Freadline,##(temp): ,(
  179.         #(ds,temp,arg2)
  180.         #(..,##(gn,temp,2))
  181.         #(ds,default.##(temp),##(value))
  182.         #(arg2,##(value))
  183.     ))
  184. ),(
  185.     arg3
  186. ))[*]
  187.  
  188.  
  189. Name:Fkbd-in
  190. Fake a keypress.  Use ##(kbd-in) as a keyboard buffer.  If it exists, just
  191. append the new key to it.  Otherwise, define g to fetch keys from the input
  192. buffer.  If arg2 is non-empty, prepend the key.
  193. #(Fkbd-in,x)#(Fkbd-in,y)
  194. #(Fkbd-in,x)#(Fkbd-in,C-g)#(Fkbd-in,y)
  195. [*]#(n?,kbd-in,,(
  196.     #(n?,kbd-macro-g,(
  197.         #(Fredefine,g,(#(Fkbd-macro-g,#(SELF-do))))
  198.     ),(
  199.         #(Fredefine,g,##(gs,SELF-do))
  200.     ))
  201. ))
  202. #(ds,kbd-in,
  203.     #(==,arg2,,,arg1<>)
  204.     #(==,arg1,C-g,,(##(kbd-in)))
  205.     #(==,arg2,,arg1<>)
  206. )[*]
  207.  
  208.  
  209. Name:Fkbd-in-do
  210. Fake a keypress.
  211. [*]##(fm,kbd-in,<>,(
  212.     #(es,kbd-in)
  213.     #(Funredefine,g)
  214.     #(g)
  215. ))[*]
  216.  
  217.  
  218. Name:Fkey2char.C-i
  219. Insert a Tab.
  220. [*](    )[*]
  221.  
  222.  
  223. Name:Fkey2char.Comma
  224. Comma self-inserts
  225. [*](,)[*]
  226.  
  227.  
  228. Name:Fkey2char.LPar
  229. LPar self-inserts
  230. [*]##(bc,40,d,a)[*]
  231.  
  232.  
  233. Name:Fkey2char.RPar
  234. RPar self-inserts
  235. [*]##(bc,41,d,a)[*]
  236.  
  237.  
  238. Name:Fkey2char.Tab
  239. Tab self inserts.
  240. [*](    )[*]
  241.  
  242.  
  243. Name:Fmessage
  244. Show a message to the user.  After the user presses a key, erase it.
  245. [*]#(ds,temp,arg1)
  246. #(an,#(temp))
  247. #(ds,mode-hook,
  248.     #    ##(fparens,(an,)##(temp))
  249.     (
  250.     #(rd)
  251.     #(ds,mode-hook,(
  252.         #(an)
  253.         #(rd)
  254.         #(es,mode-hook)
  255.     ))
  256. ))[*]
  257.  
  258.  
  259. Name:Fok-to-trash-buffer
  260. #(Fok-to-trash-buffer,FUNCTIONS) asks the user if it is ok to trash the
  261. buffer.  If the user responds with 'yes', then FUNCTIONS is executed.
  262. CRC: Added buffer name to prompt.
  263. [*]#(Fbuffer-modified,(
  264.     #(Fyes-or-no,Buffer ##(buffer-number.#(ba,-1)) has been changed - destroy it? ,(
  265.         arg1
  266.     ))
  267. ),(
  268.     arg1
  269. ),(
  270.     arg1
  271. ))
  272. [*]
  273.  
  274.  
  275. Name:Fquoted-char
  276. Prompt the user for a control character, and return the character.
  277. [*]#(an,Enter control character (\ for octal) ?)
  278. #(ds,temp,#(g))
  279. #(an)
  280. #(==,##(gn,temp,1),\,(
  281.     #(ds,value)
  282.     #(Freadline,Octal code:,(
  283.         #(ds,value,##(bc,##(value),o,a))
  284.     ))
  285.     ##(gn,value,1)
  286. ),(
  287.     #(rs,temp)
  288.     #(==,##(gn,temp,2),C-,(
  289.         ##(bc,##(--,##(bc,#(si,Fxlat-upper,##(gs,temp))),64),d,a)
  290.     ),(
  291.         #(rs,temp)
  292.         #(n?,Fkey2char.##(temp),(
  293.             #(Fkey2char.##(temp))
  294.         ),(
  295.             #(Fcase,##(temp),
  296.                 (Back Space,(##(bc,8,d,a))),
  297.                 (Return,(##(bc,13,d,a))),
  298.                 (Escape,(##(bc,27,d,a))),
  299.                 (Del,(##(bc,127,d,a))),
  300.                 (#(==,##(nc,##(temp)),1,(##(temp)),(#(bl))))
  301.             )
  302.         ))
  303.     ))
  304. ))[*]
  305.  
  306.  
  307. Name:Freadline
  308. Read a line of text from the minibuffer.
  309. On entry, #(value) is the default string.
  310. arg1=prompt
  311. arg2=string to execute if input is confirmed with return.  The users input
  312.      is in #(value)
  313. arg3=mode.
  314. The mode variable lets keys be redefined in readline mode.  For example,
  315. isearch defines ^S and ^R specially, and extended-command defines space and
  316. escape specially.
  317. [*]#(ds,2nd-half)
  318. #(Freadline-an,(arg1))
  319. #(SELF-do,#(Fget-key-with-prefixes),(arg1),(arg2),
  320.     #(==,arg3,,Freadline.,arg3),##(F-delete-or-append))
  321. #(es,2nd-half)[*]
  322.  
  323.  
  324. Name:Freadline-an
  325. [*]#(sv,fc,#(F-readline-color))
  326. #(an,arg1##(value),,##(2nd-half)##(readline-msg))
  327. #(es,readline-msg)
  328. #(sv,fc,#(F-fore-color))
  329. [*]
  330.  
  331.  
  332. Name:Freadline-do
  333. [*]#(==,
  334.     #(n?,arg4.arg1,(
  335.         #(arg4.arg1,(arg3),arg5,(arg2))
  336.     ),(
  337.         #(n?,Freadline.arg1,(
  338.             #(Freadline.arg1,(arg3),arg5)
  339.         ),(
  340.             #(Freadline.other,arg1,arg5)
  341.         ))
  342.     ))
  343. ,again,(
  344.     #(Freadline-an,(arg2))
  345.     #(SELF,#(Fget-key-with-prefixes),(arg2),(arg3),arg4)
  346. ))[*]
  347.  
  348.  
  349. Name:Freadline.Back Space
  350. Remove the rightmost character.
  351. [*]#(ds,value,##(gn,value,#(Fmax,0,#(--,##(nc,##(value)),1))))
  352. again
  353. [*]
  354.  
  355.  
  356. Name:Freadline.C-a
  357. [*]#(ds,2nd-half,##(value)##(2nd-half))
  358. #(ds,value)
  359. again
  360. [*]
  361.  
  362.  
  363. Name:Freadline.C-b
  364. [*]#(ds,value,
  365.     ##(gn,value,#(Fmax,0,#(--,##(nc,##(value)),1)))
  366.     #(ds,2nd-half,##(go,value)##(2nd-half))
  367. )again
  368. [*]
  369.  
  370.  
  371. Name:Freadline.C-c
  372. Quit the readline.
  373. [*]#(an)[*]
  374.  
  375.  
  376. Name:Freadline.C-d
  377. [*]#(..,##(go,2nd-half))
  378. #(ds,2nd-half,##(gn,2nd-half,10000))
  379. again
  380. [*]
  381.  
  382.  
  383. Name:Freadline.C-e
  384. [*]#(ds,value,##(value)##(2nd-half))
  385. #(ds,2nd-half)
  386. again
  387. [*]
  388.  
  389.  
  390. Name:Freadline.C-f
  391. [*]#(ds,value,##(value)##(go,2nd-half))
  392. #(ds,2nd-half,##(gn,2nd-half,10000))
  393. again
  394. [*]
  395.  
  396.  
  397. Name:Freadline.C-g
  398. If empty input, quit the readline, else empty the input.
  399. [*]#(==,##(value)##(2nd-half),,(
  400.     #(F:ring-the-bell)
  401. ),(
  402.     #(ds,value)
  403.     #(ds,2nd-half)
  404.     again
  405. ))[*]
  406.  
  407.  
  408. Name:Freadline.C-h
  409. Delete the rightmost character.
  410. [*]#(ds,value,##(gn,value,#(Fmax,0,#(--,##(nc,##(value)),1))))
  411. again
  412. [*]
  413.  
  414.  
  415. Name:Freadline.C-k
  416. [*]#(ds,2nd-half)
  417. again
  418. [*]
  419.  
  420.  
  421. Name:Freadline.C-l
  422. Read a character out of the text buffer.
  423. [*]#(==,arg2,,,(#(ds,value)))
  424. #(ds,value,##(value)##(rm,>))
  425. #(sp,>)
  426. again[*]
  427.  
  428.  
  429. Name:Freadline.C-m
  430. Accept the input.
  431. [*]#(ds,value,##(value)##(2nd-half))
  432. #(Fhistory-save,(##(value)))
  433. #(an)arg1
  434. [*]
  435.  
  436.  
  437. Name:Freadline.C-o
  438. Read a word out of the text buffer.
  439. [*]#(==,arg2,,,(#(ds,value)))
  440. #(ds,value,##(value)##(rm,}))
  441. #(sp,}+)
  442. again[*]
  443.  
  444.  
  445. Name:Freadline.C-q
  446. Get a control character and insert it.
  447. [*]#(ds,temp,#(Fquoted-char))
  448. #(==,##(temp),##(bc,13,d,a),(
  449.     #(==,arg2,,,(#(ds,value)))
  450.     #(ds,value,
  451.         ##(value)
  452.         ##(bc,13,d,a)
  453.         ##(bc,10,d,a)
  454.     )
  455.     again
  456. ),(
  457.     #(Freadline.other,(##(temp)),arg2)
  458. ))[*]
  459.  
  460.  
  461. Name:Freadline.C-y
  462. If this is the first time, kill the old value.  Yank.
  463. [*]#(==,arg2,,,(#(ds,value)))
  464. #(..,##(ba,
  465.     ##(ba,-1)
  466.     #(..,##(ba,1,a))
  467.     #(sp,##(bc,##(++,#(Fkill.head),48),d,a)>)
  468.     #(ds,value,
  469.         ##(value)
  470.         ##(rm,##(bc,##(++,#(Fkill.head),49),d,a))
  471.     )
  472. ))
  473. again
  474. [*]
  475.  
  476.  
  477. Name:Freadline.Del
  478. [*]#(Freadline.C-d)[*]
  479.  
  480.  
  481. Name:Freadline.Delete
  482. [*]#(Freadline.C-d)[*]
  483.  
  484.  
  485. Name:Freadline.Down Arrow
  486. [*]#(Freadline.M-n)[*]
  487.  
  488.  
  489. Name:Freadline.End
  490. [*]#(Freadline.C-e)[*]
  491.  
  492.  
  493. Name:Freadline.Home
  494. [*]#(Freadline.C-a)[*]
  495.  
  496.  
  497. Name:Freadline.Left Arrow
  498. [*]#(Freadline.C-b)[*]
  499.  
  500.  
  501. Name:Freadline.M-n
  502. [*]#(Fhistory-next)
  503. #(ds,value,#(history.##(history-ptr)))
  504. again
  505. [*]
  506.  
  507.  
  508. Name:Freadline.M-p
  509. [*]#(Fhistory-previous)
  510. #(ds,value,#(history.##(history-ptr)))
  511. again
  512. [*]
  513.  
  514.  
  515. Name:Freadline.Return
  516. Return accepts the input.
  517. [*]#(ds,value,##(value)##(2nd-half))
  518. #(Fhistory-save,(##(value)))
  519. #(an)arg1
  520. [*]
  521.  
  522.  
  523. Name:Freadline.Right Arrow
  524. [*]#(Freadline.C-f)[*]
  525.  
  526.  
  527. Name:Freadline.Up Arrow
  528. [*]#(Freadline.M-p)[*]
  529.  
  530.  
  531. Name:Freadline.other
  532. If this is the first time, kill the old value else add printables.
  533. [*]#(==,arg2,,,(#(ds,value)))
  534. #(ds,value,
  535.     ##(value)
  536.     #(n?,Fkey2char.arg1,(
  537.         #(Fkey2char.arg1)
  538.     ),(
  539.         #(==,##(nc,arg1),1,(arg1),(#(bl)))
  540.     ))
  541. )
  542. again
  543. [*]
  544.  
  545.  
  546. Name:Fy-or-n
  547. #(Fy-or-n,PROMPT,FUNCT) will wait for a key and execute FUNCT using #(Fr) if
  548. that key is 'y' or 'n'.  Doesn't execute FUNCT if C-g (cancel) is pressed.
  549. It keeps trying until a recognized key is hit.
  550. [*]#(an,arg1 ((y/n)) )
  551. #(Fcase,#(g)#(an),
  552.     (y,(#(Fr,(arg2),y))),
  553.     (n,(#(Fr,(arg2),n))),
  554.     (C-g,()),
  555.     (
  556.         #(Fflush-input-buffer)
  557.         #(SELF,(arg1),(arg2))
  558.     )
  559. )[*]